@extends('web.layouts.app')

@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/ucenter.css')}}">
@endsection

@section('content')
    <div class="uc-wrap swrap mt20">
        <div class="uc-side L">
            <div class="uc-nav">
                <ul>
                    @include('web.user_center.menu')
                </ul>
            </div>
        </div>
        <div class="uc-main uc-mainbg user-invitation-gift R">
            <div class="plr10">
                <h3 class="uc-main-title">邀请有礼</h3>
                <!--邀请链接-->
                <ul class="user-invitation-link">
                    <li>
                        <label>投资人推广链接</label>
                        <input type="text" class="link-txt" id="J_invitation_link" value="{{ $link }}">
                    </li>
                    <button type="button" id="J_copylink" class="btn">复制链接</button>
                </ul>
                <!--温馨提示--> 
                <div class="tips-block">
                    <dl>
                        <dt><i class="icon-light"></i>温馨提示</dt>
                        <dd>该收益你匹配设置功能将实现您与客户共同分享佣金收益，请谨慎配置，如有疑问请联系客服。</dd>
                    </dl>
                </div>
            </div>
            <!--列表-->
            <div class="user-item-list">
                <h3 class="title">邀请记录</h3>
                <div class="invitor-tongji">
                    <span class="active">您已获得红包奖励：<em>{{ $money or 0 }}</em>元 </span><i>|</i>
                    <span>好友注册：<em>{{ $count }}</em>人 </span><i>|</i>
                    <span>好友投资：<em>{{$count2}}</em>人 </span>
                </div>
                <ul class="data-list invitation-log-list">

                        <li class="th">
                            <div class="col-invitor">被邀请人</div>
                            <div class="col-time">注册时间</div>
                            <div class="col-tel">验证手机</div>
                            <div class="col-invest">已投资</div>
                            <div class="col-gain">我得到的奖励</div>
                        </li>
                    @forelse($data as $u)
                        <li>
                            <div class="col-invitor">
                                @if(!empty($u->name))
                                    {{$u->name}}
                                @elseif(!empty($u->username))
                                    {{$u->username}}
                                @elseif(!empty($u->email))
                                    {{$u->email}}
                                @elseif(!empty($u->phone_number))
                                    {{$u->phone_number}}
                                @else
                                    未知用户异常
                                @endif
                            </div>
                            <div class="col-time">{{ $u->created_at }}</div>
                            <div class="col-tel">{{ $u->phone_number_verified == 1?'已验证':'未验证' }}</div>
                            <div class="col-invest">{{ $u->count>0?'已投资':'未投资' }}</div>
                            <div class="col-gain">{{ $u->invite_money??0 }}</div>
                        </li>
                        @empty
                        <li class="no-data">
                            <p>您还没有邀请好友，赶快去邀请吧~</p>
                        </li>
                    @endforelse
                </ul>

                <div class="uc-page-box text-right">
                    <span class="total">共 <em>{{$data->total()}}</em> 条数据</span>
                    @for($i=1;$i<=$data->lastPage();$i++)
                        <a class="{{$data->currentPage()==$i?"current":""}}" href="{{ $data->url($i) }}">{{ $i }}</a>
                    @endfor
                    <span>{{ $data->currentPage() }}/{{ $data->lastPage() }}页</span>
                </div>
            </div>


        </div>
    </div>
@endsection

@section('scripts')
    <script src="{{ asset('resources/web/js/index.js') }}"></script>
    <script type="text/javascript">
        $(function(){
            var link = $('#J_invitation_link').val();
            $('#J_copylink').on('click', function() {
                alert("您的浏览器不支持此复制功能，请选中相应内容并使用Ctrl+C进行复制!");
                $('#J_invitation_link').select();
            });
        });
    </script>
@endsection